﻿@model Metro.Kashikoi.ServiceContract.Location.Organization
<script type="text/javascript" src="../../Scripts/jquery.treeview.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#treeview").treeview();
    });
</script>
<div>
    @* a treeview using JQuery Plugin http://docs.jquery.com/Plugins/Treeview*@
    <ul id="treeview" class="filetree">
        @*Root level*@
        <li><span class="folder"><a class="root" href="/Root" title="Click to view all inventories in root" id="root+@Model.Id">@Model.Name</a></span>
            <ul>
                @foreach (var facilityLevel in Model.Facilities)
                {       //facility Level
                    
                    <li><span class="folder group"><a class="group" href="/Location/Facility/@facilityLevel.Id" title="Click to view all inventories in this facility" id="facility+@facilityLevel.Id" >
                        @facilityLevel.Name</a> </span>
                        @if (facilityLevel.Units != null && facilityLevel.Units.Count > 0)
                        {       //Unit level
                            <ul>
                                @foreach (var unit in facilityLevel.Units)
                                {
                                    <li><span class="file"><a  class= "station" href="/Location/Unit/@unit.Id" title="Click to view all inventories in this unit" id="unit+@unit.Id" >
                                        @unit.Name</a> </span></li>
                                }
                            </ul>
                        }
                    </li>
                }
            </ul>
        </li>
    </ul>
</div>
